<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>

<TITLE>Scalarsoft - ChipTrac</TITLE>

<chiptrack:checkLogon sourcePage="/engineeringReport.do?action=vendor" />
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href='<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css' type='text/css' rel='stylesheet'>
<script src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<SCRIPT language="JavaScript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script>

	 //added by murali on 26/02/2004 for validating the dates on the from date and to date entered without using datepicker
		function validatefields()
		{
			formdoc = document.vendorReport
 			errMsg = '';

			var pa	= document.getElementById("errors")
			if(chkDate(formdoc.fromdate.value,'From-Date','N') == false){  

				 pa.innerHTML = errMsg;
				 formdoc.fromdate.focus();
				return false;
			}

			if(chkDate(formdoc.todate.value,'To-Date','N') == false){  

				 pa.innerHTML = errMsg;
				 formdoc.todate.focus();
				return false;
			}
			if(formdoc.fromdate.value!='' && formdoc.todate.value!=''){
				   if (!validateDateOut(formatDateAsMMDDYYYY(formdoc.fromdate.value),formatDateAsMMDDYYYY(formdoc.todate.value))){
								pa.innerHTML = "To Date cannot be less than From Date";
								formdoc.todate.focus();
							return;
						}
			}

	pa.innerHTML = errMsg;
    return true;
}


        var dateElement = "";
        function openCalendar(dateValue)
        {
	        dateElement = dateValue;
		    newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','optionsPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
			newWindow.moveTo(550,180);
			newWindow.focus();
        }
        function assignDate(passedValue)
        {
	        dateElement.value=passedValue;
		    window.focus();
        }

        function dateRange(){
        	var pa              = document.getElementById("errors");
            var form            = document.vendorReport;
            var partNoValue     = form.partNumber.options[form.partNumber.selectedIndex].value;

            if ( form.vendorName.selectedIndex == 0){
                pa.innerHTML = "Please Select Vendor";
                document.vendorReport.vendorName.focus();
                return;
            }else{
                pa.innerHTML = "";
            }

            var d = new Date();
			var day = d.getDate();
			var month = d.getMonth()+1;
			var year = d.getFullYear();
			var hour = d.getHours();
			var min = d.getMinutes();
			var sec = d.getSeconds();
			var today = month+"/"+day+"/"+year;
			var defaultPrompt = day+"/"+month+"/"+year+":"+hour+":"+min+":"+sec;
            var period="";
            var cat="";

            document.vendorReport.prompt0.value = form.vendorName[form.vendorName.selectedIndex].text;

            document.vendorReport.prompt1.value = document.vendorReport.fromdate.value;
            if(document.vendorReport.prompt1.value=='') document.vendorReport.prompt1.value='0';

            document.vendorReport.prompt2.value   = document.vendorReport.todate.value;
            if(document.vendorReport.prompt2.value=='') document.vendorReport.prompt2.value='0';

            //document.vendorReport.prompt3.value = document.vendorReport.partNumber.value;
            document.vendorReport.prompt3.value = partNoValue;
            if (document.vendorReport.prompt3.value=='')  document.vendorReport.prompt3.value ='0';

  		    document.vendorReport.prompt4.value   = defaultPrompt;


			success = true;
		    success = validatefields();
			if(success == true){

		            document.vendorReport.action="<%=chipTracContext%>/jsp/report.jsp?nameReport=Engineering/Vendor_Report.rpt";
					document.vendorReport.submit();
			}

			//added by murali on 26/02/2004 for validating the dates on the from date and to date entered without using datepicker and submit the values only if it is valid date
			
            //document.vendorReport.submit();
        }
</script>
</HEAD>

<BODY bgColor='#ffffff' leftMargin='0' topMargin='0' marginheight='0' marginwidth='0'>
   <form name ='vendorReport' method='post'>
	<input type="hidden" name="prompt0">
    <input type="hidden" name="prompt1">
    <input type="hidden" name="prompt2">
    <input type="hidden" name="prompt3">
    <input type="hidden" name="prompt4">
    <input type="hidden" name="prompt5">
    <input type="hidden" name="prompt6">
    <input type="hidden" name="prompt7">
    <input type="hidden" name="prompt8">
    <input type="hidden" name="prompt9">


    <!-- Top Header Start-->
    <%@ include file="/jsp/includes/header.jsp" %>
    <!-- Top Header End-->

    <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
    <TBODY>
    <TR>
	    <td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
	    <!-- Side Navigation start -->
	    <%@ include file="/jsp/engineering/engg_report_menu.jsp" %>
		<!-- end of the side navigations -->
	    <TD bgcolor="#ffffff">
		<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
	    <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
		<TD valign="top" width="100%">
		<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
		<BR>
		<!-- from here your body starts -->
		<center><span class="NArialW">Vendor Report</span></center>
		<img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20>
		<table border="0" width="90%" align=center>
		<tr><td colspan='4' align="left" class='NArialL'><b><font face="Verdana" size="-5" align="center" color="#ff0000" id="errors"></font><b></td></tr>
	    <tr>
            <td width="20%"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>&nbsp;</td>
            <td width="20%"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>&nbsp;</td>
            <td width="10%"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>&nbsp;</td>
            <td width="20%"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>&nbsp;</td>
            <td width="20%"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>&nbsp;</td>
            <td width="10%"><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10>&nbsp;</td>
        </tr>
        <tr>
            <td colspan=6 >
                <B><FONT id="errors" size="1" styleClass="NArialL" color='FF0000'></FONT></b>
            </td>
        </tR>
        <tr>
            <td width="20%"><font class="NArialL">Vendor Name </font></td>
            <td width="20%"><font class="NArialL">
            <select name="vendorName" class="txfield" >
		    <option value="0">-Select Vendor-</option>
			<logic:iterate id="vendorList" name="vendorList" >
				<logic:notEqual name="vendorList" value="null">
					<option value ="<bean:write name="vendorList" property="value"/>" >
						<bean:write name="vendorList" property="label"/>
					</option>
				</logic:notEqual>
			</logic:iterate>
		 </select>
            </font></td>
            <td width="10%"><font class="NArialL">&nbsp;</font></td>
            <td width="20%"><font class="NArialL">Base Product<%--<br>(<bean:message key="label.mfgPartNumber" />)--%></font></td>
   	        <td width="20%">
                <%--Added by Krishna Prasad 30-11-2004--%>
                <select name="partNumber"  class="txfield">
                    <option value="">All Base Products</option>
                    <logic:iterate id="mktgPartNumberSelectList" name="productList" type="org.apache.struts.util.LabelValueBean">
                        <logic:notEqual name="mktgPartNumberSelectList" value="null">
                            <option value="<%=mktgPartNumberSelectList.getLabel().trim()%>"><bean:write name="mktgPartNumberSelectList" property="label"/></option>
                        </logic:notEqual>
				    </logic:iterate>
                </select>
               <%-- <Input type = "text" name="partNumber" class="txfield" value="" maxlength="50" >--%> <%--commented by Krishna Prasad 30-11-2004--%>
            </td>
            <td width="10%"><font class="NArialL">&nbsp;</font></td>
        </tr>
	    <tr>
    	    <td width="20%"><font class="NArialL">From-Date</font></td>
            <td width="20%"><font class="NArialL">
      	    <input type="text" name="fromdate" size="20" class="txfield" maxlength="10"></font>&nbsp;&nbsp;&nbsp;
		    <a href="javascript:openCalendar(document.vendorReport.fromdate)" onmouseover="window.status='Click to Select Date';return true" onmouseout="window.status='';return true">
		    <img border="0" src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" width="18" height="18" ></a></td>
	        <td width="10%">&nbsp;</td>
		    <td width="20%"><font class="NArialL">To-Date</font></td>
	        <td width="20%"><font class="NArialL">
      	    <input type="text" name="todate" size="20" class="txfield" maxlength="10"></font>&nbsp;&nbsp;&nbsp;
      	    <a href="javascript:openCalendar(document.vendorReport.todate)" onmouseover="window.status='Click to Select Date';return true" onmouseout="window.status='';return true">
		    <img border="0" src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" width="18" height="18" ></a></td>
            <td width="10%">&nbsp;</td>
       </tr>
       <tr><td colsapn=6><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
	   <tr>
            <td colspan=6 align=center ><a href="javascript:dateRange()">
            <img border="0" src="<%=chipTracContext%>/jsp/includes/images/submit.gif" width="53" height="17" onmouseover="window.status='Click to Generate Vendor Report';return true" onmouseout="window.status='';return true" title="Click here to Generate Vendor Report"></a>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <%--
            <A href="<%=chipTracContext%>/jsp/engineering/engineering_reports_main.jsp">
            <img border="0" src="<%=chipTracContext%>/jsp/includes/images/cancel.gif" width="53" height="17" onmouseover="window.status='Click to Cancel and go Back';return true" onmouseout="window.status='';return true" title="Click here to Cancel and go Back"></a> --%>
            <!--Modified by varma 21 jul 2004) -->
            <a href="javascript:document.vendorReport.reset();"><img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' onmouseover="window.status='Click to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a>
            </td>
       </tr>
    </table>

<!-- till here -->
	<BR><BR><BR></TD>
	<TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
	</TR>
	</TABLE>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</form>
</BODY>
</HTML>